/// 某个医院设备未归还列表

var app = getApp()
//常量数据配置
var ConstantData = require('../../../../common/constant_data.js')
//获取应用实例  
Page({
  
  data: {
    
    hospitalName:'',
    pageSize: 20,
    pageNum: 1,
    orderList: [],
    loading:true,
    loadingComplete:false
  },


  
  onLoad: function (options) {
    var that = this;
    console.log("--------options->",options);
    var mecId = options.mecId;
    var hospitalName = options.hospitalName;

    this.setData({
      mecId: mecId,
      hospitalName: hospitalName
    });

    that.init();
  },
 
 
  
  /**
  * 页面上拉触底事件的处理函数
  */
  onReachBottom: function () {
   
    var that = this;
    if (that.data.loading && !that.data.loadingComplete) {
      that.setData({
        loading: false,
        pageNum: that.data.pageNum + 1,  //每次触发上拉事件，把searchPageNum+1  
      });
      
      that.init();
    }
  },
  

  init: function () {

    var that = this;
    app.executeRequest(function (header) {
      wx.request({
        url: ConstantData.CONSTATNT_DATA.BASE_URL + '/lease_statistic/lease/getNoReturnEqusOrder',
        header: header,
        data: {
          mecId: that.data.mecId,
          startNum:(that.data.pageNum - 1) * that.data.pageSize,
          pageSize:that.data.pageSize
        },
        success: function (res) {
          if (res.data.length == 0) {
            that.setData({
              loadingComplete: true
            });
            return;
          }
          
          var list = that.data.orderList;
          list=list.concat(res.data);
          that.setData({
            orderList: list,
            loading: true
          })
        }
      })
    });  
  
  }

})  


